<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<Style>
li.w-1of1{overflow:hidden}
</style>
<script language="javascript">
	$().ready(function(){

		$("span:[id*=Tip]").hide();

		$("#resend_dialog").dialog({
			autoOpen: false,
			bgiframe: true,
			height: 340,
			width:680,
			modal: true
		});

		$("#resend_result1").dialog({
			autoOpen: false,
			bgiframe: true,
			height: 150,
			width:355,
			modal: true
		});

		$("#resend_result2").dialog({
			autoOpen: false,
			bgiframe: true,
			height: 150,
			width:355,
			modal: true
		});
		
		if("${actionResult}" == "activated"){
			window.location.replace("<%=ServerValue.getFrontContextPath()%>/regActive.do"); 
		}else if("${actionResult}" == "exist"){
			$("#mailTip").text("该邮箱已被使用");
			$("#mailTip").show();
			$("#resend_dialog").dialog('open');
			$("#modify_send").attr('checked',true);
		}else if("${actionResult}" == "error"){
			$("#pwdTip").text('密码错误');
			$("#pwdTip").show();
			$("#resend_dialog").dialog('open');
			$("#modify_send").attr('checked',true);
		}else if("${actionResult}" == "resend_success"){
			$("#resend_result1").dialog('open');
		}else if("${actionResult}" == "modify_send_success"){
			$("#resend_result2").dialog('open');
		}
		
		$("#resend_dialog_commit").click(function(){
			var isCorrect = true;

			//clear tips
			$("span:[id*=Tip]").hide();

			if($("#modify_send").attr('checked')){
				$("#mail").val(jQuery.trim($("#mail").val()));	
				if($("#mail").attr('value') == ""){
					$("#mailTip").text("请输入邮箱");
					$("#mailTip").show();
					isCorrect = false;
				}else if($("#mail").attr('value') == "${mail}"){
					$("#mailTip").text("与目前邮箱相同");
					$("#mailTip").show();
					isCorrect = false;
				}else if($("#mail").val().match(/.+@.+\..+/)==null || $("#mail").val().indexOf(' ')>=0){
					$("#mailTip").text("邮箱格式错误");
					$("#mailTip").show();
					isCorrect = false;
				}
				
				$("#rcmail").val(jQuery.trim($("#rcmail").val()));
				if($("#rcmail").attr('value') == ""){
					$("#rcmailTip").text("请再次输入您的邮箱地址");
					$("#rcmailTip").show();
					isCorrect = false;
				}else if($("#mail").val() != $("#rcmail").val()){
					$("#rcmailTip").text("两次输入的邮箱地址不一致");
					$("#rcmailTip").show();
					isCorrect = false;
				}
				if($("#pwd").attr('value') == ""){
					$("#pwdTip").text("请输入密码");
					$("#pwdTip").show();
					isCorrect = false;
				}
			}
				
			if(isCorrect){
				//resend
				$("#resendForm").submit();
				return false;
			}
		});

		$("#resend_1").click(function(){
			$("#modify_send").attr('checked',false);
			$("#resend").attr('checked',true);
			$("span:[id*=Tip]").hide();
			$("#resend_dialog").dialog('open');
		});

		$("#resend_2").click(function(){
			$("#resend").attr('checked',false);
			$("#modify_send").attr('checked',true);
			$("span:[id*=Tip]").hide();
			$("#resend_dialog").dialog('open');
		});

		$("#resend_result_close1").click(function(){
			$("#resend_result1").dialog('close');
		});

		$("#resend_result_close2").click(function(){
			$("#resend_result2").dialog('close');
		});
	});
</script>
</head>
<body>
<div id="resend_dialog" title="重新发送激活邮件" class="m-regform" style="display:none;">
  <s:form action="resend.do" method="post" id="resendForm">
  <input type="hidden" name="loginID" value="${loginID}">
  <ul>
  <li class="w-1of1"><div class="w-head">我的邮箱地址：</div><div>${mail}</div></li>
  <li class="w-1of1"><div class="w-check"><input type="radio" name="choice" id="resend" checked="checked" /> 重新发送激活邮件到上面邮箱地址：请直接点选下方的确认按钮，即可完成申请。</div></li>
  <li class="w-1of1"><div class="w-check"><input type="radio" name="choice" id="modify_send" /> 更改上面的邮箱地址，并申请激活邮件：请完整填写以下信息后，再按确认按钮即可。</div></li>
  <li class="w-1of1"><div class="w-head">请输入新邮箱地址：</div><div><input type="text" name="mail" id="mail" maxlength="100"/><span style="display:block;"><span id="mailTip" class="msg rn">邮箱格式错误</span></span></div><div class="w-note">请使用您常用邮箱，方便日后重要信息通知。</div></li>
  <li class="w-1of1"><div class="w-head">请再次输入新邮箱地址：</div><div><input type="text" id="rcmail" maxlength="100"/><span style="display:block;"><span id="rcmailTip" class="msg rn"></span></span></div></li>
  <li class="w-1of1"><div class="w-head">请输入登录密码：</div><div><input type="password" name="pwd" id="pwd" maxlength="16"/><span style="display:block;"><span id="pwdTip" class="msg rn">请输入密码</span></span></div></li>
  </ul>
  <div align="center">
  <span style="text-align:center;"><a href="javascript:;" class="btn-mid" id="resend_dialog_commit">确认</a></span>
  </div>
  </s:form>
</div>
<div id="resend_result1" title="成功发送激活邮件" class="member-reg-alert-ok"  style="display:none;"> 
	<p>已成功向 <span class="txt-rd">${mail}</span> <br />发送激活邮件。</p>
	<div align="center">
	<span style="text-align:center;"><a href="javascript:;" class="btn-mid" id="resend_result_close1">关闭</a></span>
	</div>
</div>
<div id="resend_result2" title="已更新邮箱地址，并重新发送激活邮件" class="member-reg-alert-ok" style="display:none;"> 
	<p>已成功向 <span class="txt-rd">${mail}</span> <br />发送激活邮件。</p>
	<div align="center">
	<span style="text-align:center;"><a href="javascript:;" class="btn-mid" id="resend_result_close2">关闭</a></span>
	</div>
</div>
  <div id="main" class="member-reg">
  	<h3>耀点100会员注册</h3>
  	<img src="/images/union/union_regstep_2.gif" alt="注册流程2_激活帐号" class="step-img" />
	<div class="member-alive">
  		<p>感谢您注册耀点100会员。</p>
        <p>我们已向 <strong class="txt-rd">${mail}</strong> 发送激活邮件。<br />请您立即登录该邮箱，并点击邮件中的帐户激活链接，即可开通帐户完成注册。</p>
        <c-rt:if test="${member.applySource != 'nonmember'}">
		<p class="txt-s txt-rd">请注意：您的注册信息将保留7天（至<fmt:formatDate pattern="yyyy-MM-dd" value="${member.activateExpireDate}" />截止），请于期限内完成验证，方能注册成功。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如逾期未完成，请重新注册。</p>
		</c-rt:if>
    </div>
    <div class="tips-li">
        <strong>提示：</strong>
          <ul>
            <li>．若您长时间未收到激活邮件，可能被您的邮箱提供商认定为广告或垃圾邮件，若找不到该邮件，请查看您的垃圾邮件箱和广告邮件箱。</li>
            <li>．如确认无法找到您的激活邮件，可<a href="javascript:;" id="resend_1">重新发送激活邮件</a>，也可<a href="javascript:;" id="resend_2">更改邮箱地址</a>，用其他的邮箱再收一封新的激活邮件。</li>
            <li>．在您完成激活前，您无法正常使用耀点100的所有功能。</li>
          </ul>
     </div>
  </div>
</body>
</html>